class ListNode:
    def __init__(self, x):
        self.val = x
        self.next = None
class Solution:
    # 返回ListNode
    # 尾插法
    def ReverseList(self, pHead):
        # write code here
        if not pHead:
            return None
        t = ListNode(None)
        while pHead:
            next = pHead.next
            pHead.next = t.next
            t.next = pHead
            pHead = next
        return t.next



node1 = ListNode(10)
node2 = ListNode(11)
node3 = ListNode(13)
node1.next = node2
node2.next = node3

S = Solution()
p = S.ReverseList(node1)
while p!=None:
    print(p.val)
    p=p.next